//
//  OutPatientViewModel.m
//  HonlivApp
//
//  Created by admin on 2017/6/27.
//  Copyright © 2017年 honliv. All rights reserved.
//

#import "OutPatientViewModel.h"
#import "OuptMainModel.h"

static NSString *const optPatient_url = @"api/Account/GetOuptMain";

@implementation OutPatientViewModel

-(void)getOutPatient:(void (^)())completion{

    NSDictionary *info = @{@"patient_id":[User currentUser].patientId};
    NSString *url = [NSString stringWithFormat:@"%@%@",HOSPITAL_URL,optPatient_url];
    [NetWorker getCommonDatasWithURLStr:url body:info success:^(id result) {
        NSArray *array = [JsonHelper arrayWithJsonString:result[@"Entity"]];
        NSMutableArray *ouptArray = [NSMutableArray array];
        for (NSDictionary *dic in array) {
            OuptMainModel *model = [OuptMainModel setOuptMainInfo:dic];
            [ouptArray addObject:model];
        }
        _datasArray = ouptArray;
        completion();
    } failure:^(id result) {
        _datasArray = [NSArray array];
        completion();
        
    }];

}

@end
